﻿using System.Collections.Generic;

namespace SmartCity.Shared
{
    /// <summary>
    /// 列表输出类
    /// </summary>
    public class ListResponse<TEntity> : ActionResponse<ListResponse<TEntity>>
    {
        /// <summary>总记录数</summary>
        public int Total { get; set; }

        /// <summary>列表数据</summary>
        public IList<TEntity> Rows { get; set; }

        /// <summary>
        /// 成功
        /// </summary>
        /// <param name="total"></param>
        /// <param name="rows"></param>
        public static ListResponse<TEntity> Successful(int total, IList<TEntity> rows)
        {
            var result = Successful();
            result.Total = total;
            result.Rows = rows;
            return result;
        }
    }
}